#ifndef INSTANCE_H
#define INSTANCE_H

/*	CLASS:		Instance
	AUTHOR:		Marcelo Y. B. Hossomi
	OBS:		Abstract class

	Contains instance specific data.
*/

#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <cstring>
#include "Problem.h"
#include "Constants.h"
#include "Exception.h"
#include "NotReady.h"
#include "NotFound.h"
#include "InvalidIndex.h"
#include "Util.h"
#include "Input.h"
using namespace std;

class Instance {
protected:

	char	*name;		// Instance name
	Problem	*problem;	// Instance problem
	bool	ready;		// 'true' if loaded correctly

public:
	
	static const char	*EXT;	// Instances extension
	static const char	*DIR;	// Instances root directory

	Instance();
	virtual ~Instance();

	// Load an instance.
	virtual bool load( const char *name, Problem *problem ) throw (NotFound);

	// Get solution size.
	virtual int getSolSize() throw (NotReady) = 0;

	// Get solution column count.
	virtual int getSolCols() throw (NotReady) = 0;

	// Get solution row count.
	virtual int getSolRows() throw (NotReady) = 0;

	// Print instance data.
	virtual void print() throw (NotReady) {};

	// Write instance data to a file.
	virtual void write( const char *file ) throw (NotReady) {};

	// Return the instance full path.
	char* getPath() throw (NotReady);

	// Check if instance is ready.
	bool isReady()			{ return ready; }

};

#endif